import { BasicColumn, FormSchema } from '@/components/Table';
import { DescItem } from '@/components/Description';

/**
 * 表格列
 */
export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 80,
  },
  {
    title: '地址',
    dataIndex: 'address',
    width: 80,
  },
  {
    title: 'Logo',
    dataIndex: 'logo',
    width: 80,
  },
  {
    title: '法人姓名',
    dataIndex: 'legalPersonName',
    width: 80,
  },
  {
    title: '法人联系电话',
    dataIndex: 'legalPersonPhone',
    width: 80,
  },
  {
    title: '身份证正面',
    dataIndex: 'idCardFront',
    width: 80,
  },
  {
    title: '身份证反面',
    dataIndex: 'idCardBack',
    width: 80,
  },
  {
    title: '排序序号',
    dataIndex: 'sortOrder',
    width: 80,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 80,
  },
  {
    title: '创建时间',
    dataIndex: 'createdAt',
    width: 80,
  },
];

/**
 * 查询条件
 */
export const queryFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '商户名称',
    component: 'Input',
    componentProps: {},
    colProps: { span: 8 },
  },

  {
    field: 'status',
    label: '状态',
    component: 'Input',
    componentProps: {},
    colProps: { span: 8 },
  },
];

/**
 * 查看详情表单
 */
export const retrieveDetailFormSchema: DescItem[] = [
  {
    field: 'name',
    label: '名称',
  },
  {
    field: 'address',
    label: '地址',
  },
  {
    field: 'logo',
    label: 'Logo',
  },
  {
    field: 'legalPersonName',
    label: '法人姓名',
  },
  {
    field: 'legalPersonPhone',
    label: '法人联系电话',
  },
  {
    field: 'idCardFront',
    label: '身份证正面',
  },
  {
    field: 'idCardBack',
    label: '身份证反面',
  },
  {
    field: 'sortOrder',
    label: '排序序号',
  },
  {
    field: 'status',
    label: '状态',
  },
  {
    field: 'createdAt',
    label: '创建时间',
  },
  {
    field: 'updatedAt',
    label: '更新时间',
  },
];

/**
 * 新增/编辑表单
 */
export const insertOrUpdateFormSchema: FormSchema[] = [
  {
    field: 'id',
    // 只是为了把ID带过来
    label: '主键ID',
    component: 'Render',
    ifShow: false,
  },
  {
    field: 'name',
    label: '名称',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'address',
    label: '地址',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'logo',
    label: 'Logo',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'legalPersonName',
    label: '法人姓名',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'legalPersonPhone',
    label: '法人联系电话',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'idCardFront',
    label: '身份证正面',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'idCardBack',
    label: '身份证反面',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'sortOrder',
    label: '排序序号',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'status',
    label: '状态',
    required: false,
    component: 'Input',
    componentProps: {},
  },
];
